using Gateway.Domain.EFCore.Configuration;
using Gateway.Domain.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace Gateway.Domain.Configuration;

public class DepartmentConfiguration : AggregateRootEntityConfiguration<Department>
{
    public override void Configure(EntityTypeBuilder<Department> builder)
    {
        base.Configure(builder);
        builder.ToTable(t => t.HasComment("部门表"));
        builder.Property(x => x.DepartName).HasColumnType("varchar(200)").IsRequired().HasComment("部门名称");
        builder.Property(x => x.DepartmentCode).HasColumnType("varchar(50)").IsRequired().HasComment("项目编码");
        builder.Property(x => x.Remark).HasColumnType("varchar(2000)").HasComment("备注");
        builder.Property(x => x.SeqNo).IsRequired().HasComment("排序序号");
        builder.Property(x => x.ParentId).HasColumnType("varchar(36)").HasComment("父级标识");
        builder.Property(x => x.LevelCode).HasColumnType("varchar(500)").HasComment("层级标识");
    }
}